﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ElectroSystem.Models;
using Common;
using Common.Views;

namespace ElectroSystem.Controllers
{
    public class LogEntryController : MenusController
    {
        //
        // GET: /LogEntry/

        public ActionResult Index()
        {
            LogEntryModel lem = new LogEntryModel();
            return View(lem);
        }

        public PartialViewResult SearchByDateDESC()
        {
            List<FaultView> logdates = new FaultsServ.FaultsServiceClient().SearchByDateDESC().ToList();
            return PartialView("_logdate", logdates);
        }

        public PartialViewResult SearchByLogDate(DateTime startDate, DateTime endDate)
        {
            List<FaultView> searchdates = new FaultsServ.FaultsServiceClient().SearchByLogDate(startDate, endDate).ToList();
            return PartialView("_logdate", searchdates);
        }

        public PartialViewResult SearchByFaultID(Guid faultID)
        {
            List<FaultView> faultlogs = new FaultsServ.FaultsServiceClient().SearchByFaultID(faultID).ToList();
            return PartialView("_logdate", faultlogs);
        }

        public PartialViewResult SearchByClientID(string username)
        {
            List<FaultView> clientlogs = new FaultsServ.FaultsServiceClient().SearchByClientID(username).ToList();
            return PartialView("_logdate", clientlogs);
        }

        public PartialViewResult SearchByAllLogs(Guid faultID, string username, DateTime startDate, DateTime endDate)
        {
            List<FaultView> logs = new FaultsServ.FaultsServiceClient().SearchByLogEntries(faultID, username, startDate, endDate);
            return PartialView("_logdate", logs);
        }

    }
}
